<?php
include_once("./configure/configure.php");						//--> global var
include_once("./admin/configure/admin.config.inc.php");			//-- admin var
include_once("./admin/tools/smarty/libs/Smarty.class.php");		//--> out template

include_once("impl/ContentImpl.php");
include_once("impl/CategoryImpl.php");
include_once("impl/TagImpl.php");


include_once("includeSmarty.php");

$id		= 0;
$page 	= $_POST['page'];

if(empty($page))
	$page = 1;
	
$cacheId = $page;


if(!$smarty->isCached('index.html', $cacheId, $cacheId)){	
	$oContImpl 		= new ContentImpl(DB_TAG_MM);
	$oCatImpl 		= new CategoryImpl(DB_TAG_MM);
	$tagImpl		= new TagImpl(DB_TAG_MM);
	
	$oRecommends 	= $oContImpl->getAllRecommendTop();
	
	$title1			= '性感';
	$catIds1 		= $oCatImpl->getLeafIdsStr(24, true);
	$oContent1		= $oContImpl->getAllCategoryTop($catIds1);
	
	$title2			= '随手拍';
	$catIds2 		= $oCatImpl->getLeafIdsStr(6, true);
	$oContent2		= $oContImpl->getAllCategoryTop($catIds2);
	
	$title3			= '美女';
	$catIds3 		= $oCatImpl->getLeafIdsStr(21, true);
	$oContent3		= $oContImpl->getAllCategoryTop($catIds3);

	$title4			= '生活';
	$catIds4 		= $oCatImpl->getLeafIdsStr(23, true);
	$oContent4		= $oContImpl->getAllCategoryTop($catIds4);
	
	$title5			= '亮点';
	$catIds5 		= $oCatImpl->getLeafIdsStr(26, true);
	$oContent5		= $oContImpl->getAllCategoryTop($catIds5);
	
	$title6			= '热门';
	$oContent6		= $oContImpl->getPopularContents(1, 6);
	
	
	$oCats 			= $oCatImpl->getLeaf();
	$oTags			= $tagImpl->getTags(1, 15);
	
	
	
	$smarty->assign('oRecommends', $oRecommends);
	
	$smarty->assign('title1', $title1);
	$smarty->assign('title2', $title2);
	$smarty->assign('title3', $title3);
	$smarty->assign('title4', $title4);
	$smarty->assign('title5', $title5);
	$smarty->assign('title6', $title6);
	
	$smarty->assign('oContent1', $oContent1);
	$smarty->assign('oContent2', $oContent2);
	$smarty->assign('oContent3', $oContent3);
	$smarty->assign('oContent4', $oContent4);
	$smarty->assign('oContent5', $oContent5);
	$smarty->assign('oContent6', $oContent6);
	
	$smarty->assign('oCats', $oCats);
	$smarty->assign('oTags', $oTags);
	
}

$smarty->assign('HOME_URL', HOME_URL);
$smarty->assign('HOME_URL_HTTP', HOME_URL_HTTP);
$smarty->assign('DEBUG', DEBUG);


$smarty->display('index.html', $cacheId, $cacheId);
?>
